package com.dlq.menu.action;

import java.util.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dlq.emp.pojo.Emp_Role;
import com.dlq.emp.service.EmpService;
import com.dlq.menu.pojo.Menu;
import com.dlq.menu.service.MenuServiece;
import com.dlq.role.pojo.Role;
import com.dlq.role.pojo.Role_Menu;
import com.dlq.role.service.RoleService;

@Controller
@RequestMapping("menu")
public class MenuAction {


	@Autowired
	private RoleService roleService;
	@Autowired
	private EmpService empService;
	@Autowired
	private MenuServiece menuService;
	
	@RequestMapping("findAllmenu")
	@ResponseBody
	public Set<Menu> findAllmenu(Integer id){
		Set<Menu> lis = new HashSet<Menu>(); 
		List<Emp_Role>  li = empService.findAllEmp_Roel(id);
		for (Emp_Role er : li) {
			for (Role_Menu rm : er.getRole_menu()) {
				lis.add(rm.getMenu());
			}
		}
		return lis;
	}
}
